package com.mdxx.xczd.db.bo;

import android.content.ContentValues;
import android.content.Context;

import com.mdxx.xczd.db.dao.ServerDAO;
import com.mdxx.xczd.db.dao.VideoServerDAO;

import java.util.List;

public class VideoDataBO {

	private ServerDAO serverDAO;
	public VideoDataBO(Context context){
		serverDAO = new VideoServerDAO(context);
	}
	
	public boolean insertVideoData(String url) {
		boolean flag = false;
		ContentValues values = new ContentValues();
		values.put("video", url);
		values.put("issend", 0);
		flag = serverDAO.add("video", values);
		return flag;
	}
	
	public List<String> queryVideoData() {
		String sql = "select * from video where issend = 0";
		List<String> list = serverDAO.queryMulti(sql);
		return list;
	}
	
	public boolean updateVideoData(String url) {
		String sql = "update video set issend = 1 where video ="+"'"+url+"'";
		boolean flag = serverDAO.update(sql);
		return flag;
	}
	
	public void delVideoData() {
		String sql = "delete from video where issend = 1";
		serverDAO.delete(sql);
		
	}
}
